﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="lp_Configuration.aspx.cs"
    Inherits="ZLDC.Estate.Quantify.lp_Configuration" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>今日工作部署</title>

    <script src="flexigrid/jquery.js" type="text/javascript"></script>

    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="css/page.css" rel="stylesheet" type="text/css" />

    <script src="popup/popup2/popup.js" type="text/javascript"></script>

    <script type="text/javascript">
        function bindGrid() {

            $("#table1").flexigrid(
			{
			    sortname: "",
			    sortorder: "asc",
			    sortable: false,
			    usepager: false,
			    title: false,
			    rocmsg: '正在查询，请稍等...', //正在处理的提示信息
			    nomsg: '没有记录',
			    showTableToggleBtn: false,
			    width: "auto",
			    height: "500"
			}
		    );
        }
        function alifrm(uid, name, t_id, Rrow) {
            ShowIframe("lp_Configuration_below.aspx?Rrow=" + Rrow + "&username=" + escape(name) + "&type=1&t_id=" + t_id + "&user_id=" + uid, 680, 480, name + "工作分配");
        }

        //分配个人工作后 打XXXXX
        function popoList(type, userid, Rrow) {
            var ta = document.getElementById('table1');
            ta.rows[Rrow].cells[0].childNodes[6].value = "1";
            ta.rows[Rrow].cells[0].childNodes[0].innerHTML = "√" + ta.rows[Rrow].cells[0].childNodes[0].innerHTML.substring(1, ta.rows[Rrow].cells[0].childNodes[0].innerHTML.length);
        }

        var tbrowslength = 0;
        var tbrowsdisabled = 0
        function setColor() {
            var ta = document.getElementById('table1');
            //如果完成分配 则不同颜色或者加X
            for (var i = 1; i < ta.rows.length; i++) {
                var cell = ta.rows[i].cells[0].childNodes[6].value;

                if (cell == 1) {
                    tbrowslength++;
                    //ta.rows[i].cells[0].style.backgroundColor = '#FFCCFF';
                    ta.rows[i].cells[0].childNodes[0].innerHTML = "√" + ta.rows[i].cells[0].childNodes[0].innerHTML;
                }
                else {
                    ta.rows[i].cells[0].childNodes[0].innerHTML = "×" + ta.rows[i].cells[0].childNodes[0].innerHTML;
                }
                if (ta.rows[i].cells[0].childNodes[0].disabled == true) {
                    tbrowsdisabled++;
                }
            }

        }

        function rowscounttr() {
            //如果未部署完成，无法提交工作

            if ((tbrowsdisabled + tbrowslength) != (document.getElementById('table1').rows.length - 1)) {
                document.getElementById('Button1').disabled = true;
            }
            else {
                document.getElementById('Button1').disabled = false;
            }
        }
        function chk(obj, on1, on2, on3) {
            var rowIndex = obj.parentNode.parentNode.rowIndex;
            if (on1 == 1) {
                if (obj.checked)
                    document.getElementById('table1').rows[rowIndex].cells[on1].childNodes[0].checked = false;
            }
            if (on1 == 2) {
                if (obj.checked)
                    document.getElementById('table1').rows[rowIndex].cells[on1].childNodes[0].checked = false;
            }
            if (obj.checked) {
                document.getElementById('table1').rows[rowIndex].cells[on1].childNodes[0].disabled = "disabled";
                //document.getElementById('table1').rows[rowIndex].cells[on2].childNodes[0].disabled = "disabled";
                document.getElementById('table1').rows[rowIndex].cells[on3].childNodes[0].disabled = "disabled";

            } else {
                document.getElementById('table1').rows[rowIndex].cells[on1].childNodes[0].disabled = "";
                //document.getElementById('table1').rows[rowIndex].cells[on2].childNodes[0].disabled = "";
                document.getElementById('table1').rows[rowIndex].cells[on3].childNodes[0].disabled = "";

            }

            var ta = document.getElementById('table1');
            tbrowsdisabled = 0;
            for (var i = 1; i < ta.rows.length; i++) {
                if (ta.rows[i].cells[0].childNodes[0].disabled == true) {
                    tbrowsdisabled++;
                }
            }
            //rowscounttr();

        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div runat="server" id="span1" style="display: none">
            分行:<select id="sBranch" name="sBranch" runat="server" style="width: 120px;">
            </select><asp:Button ID="btnGetlist" runat="server" Text="查询" OnClick="btnGetlist_Click" /></div>
        <asp:Panel ID="Panel2" runat="server" Width="95%">
            <table id="table1" border='0' cellpadding='0' cellspacing='1' bgcolor='#a8c7ce' width="700px">
                <thead>
                    <tr>
                        <th align="center" width="60" bgcolor='d3eaef' class='STYLE6'>
                            姓名
                        </th>
                        <th align="center" width="80" bgcolor='d3eaef' class='STYLE6'>
                            自己选择
                        </th>
                        <th align="center" width="60" bgcolor='d3eaef' class='STYLE6'>
                            是否请假
                        </th>
                        <th align="center" width="220" bgcolor='d3eaef' class='STYLE6'>
                            今日工作建议
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <asp:Repeater ID="RpList" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td class='STYLE10'>
                                    <a style="cursor: pointer" title="点击此处查看详细" onclick='alifrm("<%# Eval("userid")%>","<%# Eval("Other2")%>",<%# Eval("deptid") %>,<%# Container.ItemIndex + 1%>)'>
                                        <%# Eval("Other2")%></a>
                                    <asp:HiddenField ID="hidid" runat="server" Value='<%# Eval("userid") %>' />
                                    <asp:HiddenField ID="hiddeptid" runat="server" Value='<%# Eval("deptid") %>' />
                                    <asp:HiddenField ID="hidSoure" runat="server" Value='<%#Eval("Other1").ToString()!=""?1:0 %>' />
                                    <asp:HiddenField ID="hidmain_id" runat="server" Value='<%# Eval("id") %>' />
                                    <asp:HiddenField ID="hidworkday" runat="server" Value='<%# Eval("workday") %>' />
                                    <asp:HiddenField ID="hidtf" runat="server" />
                                </td>
                                <td class='STYLE10'>
                                    <asp:CheckBox ID="CheckBox2" Checked='<%#Eval("Other1").ToString()=="1"?true:false %>'
                                        runat="server" onclick="chk(this,2,3,0)" />
                                </td>
                                <td class='STYLE10'>
                                    <asp:CheckBox ID="CheckBox1" Checked='<%#Eval("leave").ToString()=="1"?true:false %>'
                                        runat="server" onclick="chk(this,1,3,0)" />
                                </td>
                                <td class='STYLE10'>
                                    <asp:TextBox ID="txtRemark" Width="100%" Height="42px" TextMode="MultiLine" runat="server"></asp:TextBox>

                                    <script type="text/javascript">
                                        //                                        var userid = '<%# Eval("userid") %>';
                                        //                                        var workday = '<%# Eval("workday") %>';
                                        //                                        var mainid = '<%# Eval("id") %>';
                                        //                                        var rowindex = '<%# Container.ItemIndex%>';
                                        //                                        var txtremark = document.getElementById('RpList_ctl0' + rowindex + '_txtRemark');
                                        //                                        $.ajax({
                                        //                                            type: "POST",
                                        //                                            url: "AjaxServer.aspx",
                                        //                                            dataType: 'json',
                                        //                                            data: "alt=GetRemark&mainid=" + mainid + "&userid=" + userid + "&workday=" + escape(workday) + "",
                                        //                                            processData: false,
                                        //                                            timeout: '10000',
                                        //                                            success: function(msg) {
                                        //                                            txtremark.value = msg.msg;
                                        //                                                
                                        //                                            },
                                        //                                            error: function() {

                                        //                                            }

                                        //                                        });
                                    </script>

                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
            <asp:Button ID="Button1" runat="server" Text="完成部署" OnClick="Button1_Click" CssClass="button1" />
            <%-- <webdiyer:AspNetPager ID="AspNetPager1" runat="server" CssClass="paginator" SubmitButtonText="跳转" Visible="false"
                    Width="700px" ShowPageIndexBox="Always" HorizontalAlign="Left" AlwaysShow="True"
                    PageIndexBoxClass="pageTextBox" SubmitButtonClass="ibutton" SubmitButtonStyle=""
                    CustomInfoTextAlign="Left" LayoutType="Table" 
                    ShowCustomInfoSection="Left"  OnPageChanged="AspNetPager1_PageChanged" 
                    FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" 
                    UrlPaging="True" CenterCurrentPageButton="True">
                </webdiyer:AspNetPager>--%>
        </asp:Panel>

        <script type="text/javascript">
            window.onload = function() {
                setColor();

            }
        </script>

    </div>
    </form>
</body>
</html>
